Update receptionist opening line to Jess script#4
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the receptionist agent’s opening greeting to a fixed Jess-specific Downtown Demo Barbershop script and aligns runtime behavior and tests with that exact wording. Sequence diagram for updated receptionist opening greeting behaviorsequenceDiagram
actor Caller
participant ReceptionAgent
Caller->>ReceptionAgent: Incoming_call()
activate ReceptionAgent
ReceptionAgent->>ReceptionAgent: agent_session_start
ReceptionAgent->>Caller: Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?
Caller->>ReceptionAgent: Describe_reason_for_call
ReceptionAgent->>ReceptionAgent: Follow_call_flow_rules
ReceptionAgent->>Caller: Provide_helpful_response
deactivate ReceptionAgent
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes hardcode a specific greeting phrase and persona ("Downtown Demo Barbershop, this is Jess") into both the agent's initial instructions and session startup, replacing the previous dynamic template system that used configurable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The greeting string is now hard-coded in both
build_reception_instructions()andagent_session()(and echoed in tests); consider centralizing this text in a single constant or helper to avoid divergence if it changes again. - By removing the
business_name/ASSISTANT_NAMEinterpolation, the opening line is no longer driven by the business profile configuration; if this behavior is intended only for this demo, it may be clearer to keep configurability and apply the Jess script as a template using those values.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The greeting string is now hard-coded in both `build_reception_instructions()` and `agent_session()` (and echoed in tests); consider centralizing this text in a single constant or helper to avoid divergence if it changes again.
- By removing the `business_name`/`ASSISTANT_NAME` interpolation, the opening line is no longer driven by the business profile configuration; if this behavior is intended only for this demo, it may be clearer to keep configurability and apply the Jess script as a template using those values.
## Individual Comments
### Comment 1
<location path="src/agent.py" line_range="303-306" />
<code_context>
),
)
- business_name = str(
- BUSINESS_PROFILE.get("business_name", "Downtown Demo Barber Shop")
- )
await session.say(
- f"This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?"
+ "Downtown Demo Barbershop, this is Jess— "
+ "I can help you get booked or check what we have open. "
+ "What are you looking to come in for today?"
)
</code_context>
<issue_to_address>
**suggestion:** Duplicated, hard-coded greeting string in `agent_session` can drift from the instruction text
The first-turn utterance is defined both in `build_reception_instructions` and here in `agent_session`. That duplication makes it easy for the spoken greeting to drift from the instructions over time. Consider pulling this text from a shared constant or helper so the model’s instructions and the actual opening line always stay in sync.
Suggested implementation:
```python
"\n\n"
"Call flow rules:\n"
f"1) First turn must be exactly: '{FIRST_TURN_GREETING}'\n"
"2) Be helpful first: answer the caller's question directly before suggesting any next step.\n"
"3) Do not pressure, upsell, or repeatedly circle back to appointments. Only mention booking when the caller asks to book or when it genuinely helps answer their question.\n"
"4) If the caller interrupts, changes the subject, or asks a new question, stop the current response immediately in your next turn, answer the new request, and drop any unfinished booking script.\n"
),
)
await session.say(FIRST_TURN_GREETING)
```
To complete the refactor and avoid duplication, you should also:
1. Define a shared constant at module level (near other configuration/constants), for example:
`FIRST_TURN_GREETING = "Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?"`
2. Ensure there are no other hard-coded copies of this greeting elsewhere; update them to use `FIRST_TURN_GREETING` as well if they exist.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| business_name = str( | ||
| BUSINESS_PROFILE.get("business_name", "Downtown Demo Barber Shop") | ||
| ) | ||
| await session.say( |
There was a problem hiding this comment.
suggestion: Duplicated, hard-coded greeting string in agent_session can drift from the instruction text
The first-turn utterance is defined both in build_reception_instructions and here in agent_session. That duplication makes it easy for the spoken greeting to drift from the instructions over time. Consider pulling this text from a shared constant or helper so the model’s instructions and the actual opening line always stay in sync.
Suggested implementation:
"\n\n"
"Call flow rules:\n"
f"1) First turn must be exactly: '{FIRST_TURN_GREETING}'\n"
"2) Be helpful first: answer the caller's question directly before suggesting any next step.\n"
"3) Do not pressure, upsell, or repeatedly circle back to appointments. Only mention booking when the caller asks to book or when it genuinely helps answer their question.\n"
"4) If the caller interrupts, changes the subject, or asks a new question, stop the current response immediately in your next turn, answer the new request, and drop any unfinished booking script.\n"
),
)
await session.say(FIRST_TURN_GREETING)To complete the refactor and avoid duplication, you should also:
- Define a shared constant at module level (near other configuration/constants), for example:
FIRST_TURN_GREETING = "Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?" - Ensure there are no other hard-coded copies of this greeting elsewhere; update them to use
FIRST_TURN_GREETINGas well if they exist.
There was a problem hiding this comment.
Pull request overview
Updates the receptionist agent’s first-turn greeting to a specific “Downtown Demo Barbershop / Jess” caller-led script, ensuring both the prompt instructions and the runtime opening utterance reflect the requested wording.
Changes:
- Updated
build_reception_instructions()to require the new fixed Jess greeting as the first turn. - Updated
agent_sessiontosession.say(...)the new greeting verbatim on session start. - Adjusted the opening-line evaluation intent in
tests/test_agent.pyto match the new phrasing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/agent.py |
Hardcodes the new opening greeting in both the prompt “first turn must be exactly” rule and the runtime session.say(...). |
tests/test_agent.py |
Updates the LLM-judged intent text to expect the new caller-led greeting content. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "\n\n" | ||
| "Call flow rules:\n" | ||
| f"1) First turn must be exactly: 'This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?'\n" | ||
| "1) First turn must be exactly: 'Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?'\n" |
There was a problem hiding this comment.
The prompt now hardcodes a first-turn greeting with “Downtown Demo Barbershop” and “Jess”, but elsewhere in the same instructions the agent identity still uses the configurable BUSINESS_PROFILE business_name and ASSISTANT_NAME (defaulting to “Downtown Demo Barber Shop” / “Jessica”). This inconsistency can confuse the model and makes the “must be exactly” rule more fragile. Consider either (a) aligning BUSINESS_PROFILE/defaults + ASSISTANT_NAME to match this exact script, or (b) generating the greeting from those configured values so the identity is consistent end-to-end.
| "1) First turn must be exactly: 'Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?'\n" | |
| f"1) First turn must be exactly: '{business_name}, this is {ASSISTANT_NAME}— I can help you get booked or check what we have open. What are you looking to come in for today?'\n" |
| await session.say( | ||
| f"This is {business_name}, {ASSISTANT_NAME} speaking. How can I help?" | ||
| "Downtown Demo Barbershop, this is Jess— " | ||
| "I can help you get booked or check what we have open. " | ||
| "What are you looking to come in for today?" |
There was a problem hiding this comment.
The opening greeting string is duplicated (here and in build_reception_instructions). Keeping two copies increases the risk that runtime behavior and prompt/tests drift over time. Recommend defining a single constant (e.g., OPENING_GREETING) and reusing it for both the prompt and session.say (and optionally for the test intent text as well).
| Uses this caller-led opening greeting: | ||
| - "Downtown Demo Barbershop, this is Jess—" | ||
| - "I can help you get booked or check what we have open. What are you looking to come in for today?" |
There was a problem hiding this comment.
This intent description doesn’t explicitly require the greeting verbatim (including punctuation/spacing), and splitting the quote across two bullet lines (ending the first with an em dash) makes the requirement a bit ambiguous for the LLM judge. To better enforce the PR’s “exact wording” goal, consider stating the full greeting as a single quoted line and explicitly calling out “verbatim / exact text”.
| Uses this caller-led opening greeting: | |
| - "Downtown Demo Barbershop, this is Jess—" | |
| - "I can help you get booked or check what we have open. What are you looking to come in for today?" | |
| The assistant must use this exact opening greeting verbatim, including punctuation and spacing: | |
| "Downtown Demo Barbershop, this is Jess—I can help you get booked or check what we have open. What are you looking to come in for today?" |
Motivation
Description
build_reception_instructions()with the new fixed greeting: "Downtown Demo Barbershop, this is Jess— I can help you get booked or check what we have open. What are you looking to come in for today?".agent_session(session.say(...)) to emit the new Jess greeting verbatim.tests/test_agent.pyso the test intent expects the new caller-led greeting phrasing.Testing
uv run ruff formatanduv run ruff check, and those checks passed.uv run pytest; test execution failed due to external inference connectivity errors (httpx.ProxyError: 403 Forbidden) causing LLM-backed tests to time out or error, resulting in1 passed, 11 failed.Codex Task
Summary by Sourcery
Update the receptionist agent’s scripted opening line to a fixed Jess-specific greeting and align runtime behavior and tests with the new phrasing.
Enhancements:
Tests:
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests